{% extends "base.html" %}
{% block head %}
<style type="text/css">
	.cke_skin_v2{
	}
	#mainContent{
		margin-right:300px;
	}
	#mainContent .titleWrap .title{
		width:100%;
		height:30px;
		padding:2px 5px;
		-moz-box-sizing: border-box;
		-webkit-box-sizing: border-box;
		box-sizing: border-box;
	}
	#secondContent{
		width:270px;
		float:right;
		padding-top:50px;
	}
	.submitBlock,.categBlock{
		width:260px;
		margin-bottom:10px;
	}
	.categBlock input{
		margin-right:4px;
	}
</style>
<script type="text/javascript" src="/static/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/static/ckfinder/ckfinder.js"></script>
<script type="text/javascript">	
$(function(){
		var editor = CKEDITOR.replace( 'postContent');
		
		$('.draft').click(function(){
			$('#newPost').attr('action','/admin/newPost?mode=0')
			$('#newPost').submit();
		})		
})
</script>
{% endblock %}

{% block contentWrap %}
<form action="/admin/newPost" method="post" id="newPost">
<div id="secondContent">
	<div class="block_mod submitBlock">
		<div class="header">发布</div>
		<div class="content">	
			<input type="submit" value="发布" class="submit">
			<input type="button" value="保存草稿" class="draft">
			<input type="button" value="预览" class="preview">
		</div>
	</div>
	<div class="block_mod categBlock">
		<div class="header">分类</div>
		<div class="content">
			<ul>
				{% for categ in categs %}
					{% if loop.index==1 %}
					<li><input type="radio" name="categId" value="{{categ.id}}" checked="checked" id="categ{{categ.id}}"/><label for="categ{{categ.id}}">{{categ.name}}</label></li>
					{% else %}
					<li><input type="radio" name="categId" value="{{categ.id}}" id="categ{{categ.id}}"/><label for="categ{{categ.id}}">{{categ.name}}</label></li>
					{% endif %}
				{% endfor %}
			</ul>
		</div>
	</div>
</div>
	<div id="mainContent">
	<h2>文章</h2>
	标题：
	<div class="titleWrap"><input type="text" name="title" class="title"/></div>
	内容：
	<textarea name="content" id="postContent" cols="30" rows="10"></textarea>
	</div>
</form>
{% endblock %}
